package com.micro.shop.controller;

import com.micro.shop.feign.UserAddClient;
import com.micro.user.api.UserAddFeign;
import com.micro.user.vo.UserVo;
import org.apache.catalina.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * <p>
 * </p>
 *
 * @author zcf
 * @since 2021/4/14
 */
@RestController
public class ShopHalloController {

    @Resource
    private UserAddFeign userAddClient;


    @GetMapping("hello")
    public String sayHello(){
        return "shop ~~ hello";
    }


    @GetMapping("userAdd")
    public String addUser(String name) {
        UserVo userVo = new UserVo();
        userVo.setName(name);
        userVo.setAge(100);
        String s = userAddClient.addUser(userVo);
        return s;
    }

    @GetMapping("removeUser")
    public String removeUser(String name) {
        Integer integer = userAddClient.removeUser(name);
        return integer.toString();
    }
}
